<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico"/>
    <script type="text/javascript" src="/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/lib/respond.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/h-ui.admin/css/style.css"/>
    <script type="text/javascript" src="/js/vue/vue.min.js"></script>
    <script type="text/javascript" src="/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <title>销售历史</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
</head>
<body>
<div id="app">

    <article class="page-container">
        <h1 style="text-align: center">销售历史</h1>
        <div> <table class="table table-border table-bordered table-bg">
            <thead>
            <tr>
                <th scope="col" colspan="9">商品列表</th>
            </tr>
            <tr class="text-c">
                <th width="40">客户</th>
                <th width="170">处理状态</th>
                <th width="170">单据编号</th>
                <th width="100">经手人</th>
                <th width="100">业务日期</th>
                <th width="100">关联订单号</th>
            </tr>
            </thead>
            <tbody>
            <tr class="text-c" >
                <td th:text="${session.sales.shClient}" id="shClient"></td>
                <td th:text="${session.sales.shStatus}" id="shStatus"></td>
                <td th:text="${session.sales.shNumber}" id="shNumber"></td>
                <td th:text="${session.sales.shHander}" id="shHander"></td>
                <td th:text="${session.sales.shDate}" id="shDate"></td>
                <td th:text="${session.sales.shConnect}" id="shConnect"></td>
                <input type="text" hidden="hidden" th:value="${session.sales.id}" id="idCloud">
            </tr>
            </tbody>
        </table>
        </div>
        <form class="form form-horizontal" id="form-article-add">
            <table class="table table-border table-bordered table-bg" id="testTable">
                <thead>
                <tr>
                    <th scope="col" colspan="9">销售订单商品列表详细</th>
                </tr>
                <tr class="text-c">
                    <th width="40">序号</th>
                    <th width="170">商品名称/规格</th>
                    <th width="170">商品编号</th>
                    <th width="170">属性</th>
                    <th width="100">数量</th>
                    <th width="100">单位</th>
                    <th width="150">折扣</th>
                    <th width="150">单价</th>
                    <th width="200">备注</th>
                </tr>
                </thead>
                <tbody>
                <tr class="text-c" v-for="(item,index) in result">
                    <td>{{index+1}}</td>
                    <td>{{item.commodityList.clName}}</td>
                    <td>{{item.commodityList.clNumber}}</td>
                    <td>属性</td>
                    <td id="listCount">{{item.orderCount}}</td>
                    <td>{{item.commodityList.clUnit}}</td>
                    <td>1.00</td>
                    <td>{{item.commodityList.clTagPrise}}</td>
                    <td>无</td>
                </tr>
                </tbody>
                <thead>
                <tr class="text-c" id="count">
                    <th width="40">
                        合计
                    </th>
                    <td width="130"></td>
                    <td width="150"></td>
                    <td width="150"></td>
                    <td width="90" ></td>
                    <td width="90"></td>
                    <td width="130"></td>
                    <td width="150" id="counte">金额</td>
                    <td width="100"></td>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td width="300"><span style="text-align: right"><h3>总计金额：</h3><span style="color: red"></span></span></td>
                    <td th:text="${session.sales.shMoney}" id="shMoney"></td>
                    <td></td>
                    <td> <a href="javascript:;" onclick="submitAdd()"
                            class="btn btn-primary radius">
                        <i class="Hui-iconfont">&#xe603;</i>出库</a></td>
                    <td> <a href="javascript:;" onclick="submitOut()"
                            class="btn btn-primary radius">
                        <i class="Hui-iconfont">&#xe603;</i>退货</a></td>
                </tr>
                </tbody>
            </table>
        </form>
    </article>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="/lib/ueditor/1.4.3/ueditor.all.min.js"></script>
<script type="text/javascript" src="/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript">


    var app= new Vue({
        el: '#app',
        data: {
            result: []
        }
    });

    /*遍历订单所有的商品*/
    var getCommodityList = function (curr) {
        var id =$("#idCloud").val();
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: '/cargomanagement/sales-history/detailList',
            data: {id:id},
            success: function (msg) {
                app.result = msg;
            }
        });

    };
    getCommodityList();

    var submitAdd =function () {
        var aid =$("#idCloud").val();
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: '/cargomanagement/sales-history/changeToSale',
            data: {
                woCompany: $("#shClient").html(),
                woStatus: $("#shStatus").html(),
                woNumber:$("#shNumber").html(),
                woHander:$("#shHander").html(),
                woCreateDate: $("#shDate").html(),
                aid:aid
            },
            success: function (msg) {
                if (msg){
                    layer.msg('成功',{icon:1});
                }
            }
        });
    };

    var submitOut =function () {
        var aid =$("#idCloud").val();
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: '/cargomanagement/sales-history/changeToOut',
            data: {
                srhClient: $("#shClient").html(),
                srhStatus: $("#shStatus").html(),
                srhNumber:$("#shNumber").html(),
                srhHander:$("#shHander").html(),
                srhDate: $("#shDate").html(),
                aid:aid
            },
            success: function (msg) {
                if (msg){
                    layer.msg('成功',{icon:1});
                }
            }
        });
    };
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>